package pers.linkong.asr.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import pers.linkong.asr.domain.ImageBean;
import pers.linkong.asr.mapper.ImageMapper;

@Service
// Service组件
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.SERIALIZABLE, readOnly = false)
public class ImageService {
	@Autowired
	private ImageMapper imageMapper;

	// 增
	public void addImage(ImageBean image) throws Exception {
		this.imageMapper.addImage(image);
		System.out.println("添加图片：" + image.getImgid());
		// throw new RuntimeException();
	}

	// 删
	public void deleteImage(int Tid) throws Exception {
		this.imageMapper.deleteImage(Tid);
		System.out.println("删除图片：" + Tid);
	}
	
	// 获取IMG最后一个图片的ID
	public int getlastimgid() throws Exception {
		return this.imageMapper.getlastimgid();
		
	};
}
